package cn.wolfcode.crm.service.impl;

import cn.wolfcode.crm.domain.FormalCustomer;
import cn.wolfcode.crm.mapper.FormalCustomerMapper;
import cn.wolfcode.crm.query.QueryObject;
import cn.wolfcode.crm.service.IFormalCustomerService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FormalCustomerServiceImpl implements IFormalCustomerService {
    @Autowired
    private FormalCustomerMapper formalCustomerMapper;

    public void save(FormalCustomer entity) {
            formalCustomerMapper.insert(entity);
    }

    public PageInfo<?> queryForList(QueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize(),"vdate desc");
        List<?> list = formalCustomerMapper.selectForList(qo);
        return new PageInfo<>(list);
    }
}
